﻿using System.Collections.Generic;
using System.Linq;
using RSteel.DAL;
using RSteel.DAO;

namespace RSteel.DAO
{
    public class NewsDao : BaseDaoContext<News>
    {
        protected NewsDao()
        {
        }

        #region Singelton

        protected static NewsDao instance;

        public static NewsDao Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new NewsDao();
                }
                return instance;
            }
        }

        #endregion

        public List<News> GetObjects(int count)
        {
            using (var dc = GetDataContext())
            {
                List<News> news = dc.News.Take(count).ToList();
                return news;
            }
        }
    }
}